package org.example.com.atguigu.service.impl;



import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.com.atguigu.mapper.AppointmentMapper;
import org.example.com.atguigu.po.Appointment;
import org.example.com.atguigu.service.IAppointmentService;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author JBL
 * @since 2025-04-29
 */
@Service
public class AppointmentServiceImpl extends ServiceImpl<AppointmentMapper, Appointment> implements IAppointmentService {
    /**
     * 查询订单是否存在
     *
     * @param appointment
     * @return
     */
    @Override
    public Appointment getOne(Appointment appointment) {
        LambdaQueryWrapper<Appointment> appointmentLambdaQueryWrapper = new LambdaQueryWrapper<Appointment>();
        appointmentLambdaQueryWrapper.eq(Appointment::getUsername,appointment.getUsername());
       // appointmentLambdaQueryWrapper.eq(Appointment::getId,appointment.getId());
        appointmentLambdaQueryWrapper.eq(Appointment::getIdCard,appointment.getIdCard());
        appointmentLambdaQueryWrapper.eq(Appointment::getDate,appointment.getDate());
        appointmentLambdaQueryWrapper.eq(Appointment::getDepartment,appointment.getDepartment());
        appointmentLambdaQueryWrapper.eq(Appointment::getTime,appointment.getTime());
        Appointment appointmentDB = baseMapper.selectOne(appointmentLambdaQueryWrapper);

        return appointmentDB;
    }
}
